package cn.wgspring.wedding_helper.settings

import com.russhwolf.settings.*

/**
 * 应用设置管理类，作为StorageManager的简单包装器
 */
class AppSettings(private val settings: Settings) {
    companion object {
        // 单例实例
        private var instance: AppSettings? = null

        fun getInstance(): AppSettings {
            if (instance == null) {
                instance = AppSettings(Settings())
            }
            return instance!!
        }
    }

    // 存储管理器实例
    private val storageManager = StorageManager.getInstance()

    /**
     * 保存当前选中的Tab索引
     */
    fun saveSelectedTab(tabIndex: Int) {
        storageManager.saveSelectedTab(tabIndex)
    }

    /**
     * 获取保存的Tab索引，默认为0
     */
    fun getSelectedTab(): Int {
        return storageManager.getSelectedTab()
    }

    /**
     * 保存时间段的展开状态
     */
    fun saveTimePhaseExpandedState(timePhase: String, expanded: Boolean) {
        storageManager.saveTimePhaseExpandedState(timePhase, expanded)
    }

    /**
     * 获取时间段的展开状态，默认为展开
     */
    fun getTimePhaseExpandedState(timePhase: String): Boolean {
        return storageManager.getTimePhaseExpandedState(timePhase)
    }

    /**
     * 保存使用方的展开状态
     */
    fun saveUserGroupExpandedState(userGroup: String, expanded: Boolean) {
        storageManager.saveUserGroupExpandedState(userGroup, expanded)
    }

    /**
     * 获取使用方的展开状态，默认为展开
     */
    fun getUserGroupExpandedState(userGroup: String): Boolean {
        return storageManager.getUserGroupExpandedState(userGroup)
    }
}